home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
compuserve-file-archive
/
05 Programming
/
UNX30A.SFX
/
shar.bas
< prev
next >
Wrap
BASIC Source File
|
1991-06-22
|
6KB
|
150 lines
2 REM "SHAR" SEQUENTIAL FILES PROGRAM
4 :
6 :
8 REM "┬╒╟╙ : ╘HE DIRECTORY READ ROUTINE SHOULD BE IN MACHINE CODE.
9 REM " : ╘HIS PROGRAM SHOULD BE COMPILED, ALTERNATELY.
10 REM " : ┴LL FILES TO BE ARCHIVED HAVE TO BE ONLINE AND AVAILABLE
12 REM " AT THE SAME TIME.
13 REM " : ╧UTPUT IS IN ╨┼╘╙├╔╔, ╦ERMIT OR OTHER PROTOCOL IS EXPECTED
14 REM " TO PERFORM ANY NEEDED ┴╙├╔╔ TRANSLATION.
15 REM " : ╘HE ARCHIVE PRODUCED DOES NOT CHECK FOR CORRECT SIZE NOR DOES
16 REM " IT SET THE FILE PERMISSIONS TO SANE SETTINGS.
18 REM " : ╘HERE MAY BE PROBLEMS ON A SINGLE 1541/1571 WITH OPENING A
20 REM " WRITE FILE AND OPENING/CLOSING SEVERAL SEQUENTIAL FILES DURING
22 REM " THE COURSE OF CREATING THE ARCHIVE. ╘HIS IS A ─╧╙ PROBLEM.
24 REM " : ─╧╙ ERRORS ARE EITHER IGNORED OR HANDLED UNGRACEFULLY.
26 REM " : ╘HIS PROGRAM ONLY WILL SHAR ╙┼╤UENTIAL FILES.
28 REM " : ╘HIS PROGRAM IS LONGER THAN IT NEEDS TO BE.
30 :
32 :
34 PRINTCHR$(14)"╘HIS PROGRAM TAKES MULTIPLE ┴╙├╔╔"
36 PRINT"SEQUENTIAL FILES AND PRODUCES A ╒╬╔╪"
38 PRINT"STYLE 'SHELL ARCHIVE' (SHAR). ╔T CAN"
40 PRINT"TAKE FILES FROM SEVERAL DIFFERENT"
42 PRINT"DEVICES/DRIVES PROVIDED ALL ARE ONLINE"
44 PRINT"AT THE SAME TIME."
46 PRINTCHR$(17)"├REATED BY ╩OE ╟RECO <JGRECO@ARCHIMEDES.MATH.UWM.EDU>"
48 PRINT"╨LEASE ┼-MAIL BUG REPORTS, ETC. TO ME."
50 PRINT:PRINT"╩OE ╟RECO":PRINT"9905 ╫. ═ONTANA ┴VE."
52 PRINT"╫EST ┴LLIS, ╫╔ 53227-3329"
54 ME$="╘HE ╒NKNOWN ├64 ╒SER": REM UNIX USER'S NAME/E-MAIL ADDRESS
56 PRINTCHR$(17)"LOADING SHAR.OBJ"CHR$(17):ML=49152
58 A=ML
60 READ X:IFX<>-1THENPOKEA,X:A=A+1:GOTO60
62 DIM F$(1000),F1$(1000),U(1000),D$(1000):FP=0
64 PRINT CHR$(17)"╔NPUT FILE PATTERN [*]";:F2$="*":INPUT F2$
66 :
68 PRINTCHR$(17)"╔NPUT DEVICE/UNIT # [8]";:U2=8:INPUT U2
70 IFU2<8ORU2>31THENPRINT"╔NVALID! 8-31 ONLY PLEASE":GOTO68
72 :
74 PRINTCHR$(17)"╔NPUT DRIVE # [0]";:D2$="0":INPUT D2$
76 IFD2$<>"0"ANDD2$<>"1"THENPRINT"╔NVALID! 0 OR 1 ONLY PLEASE":GOTO74
78 :
80 PRINTCHR$(17)"─O YOU WISH TO STRIP A FILENAME PREFIX?"
82 PRINT"╔F SO, ENTER IT AT THIS TIME (OR JUST"
84 PRINT"PRESS ╥┼╘╒╥╬):";:SR$="*":INPUT SR$
86 :
88 CLOSE15:OPEN15,U2,15,"I"+D2$:CM=0
90 CLOSE4:OPEN4,U2,.,"$"+D2$+":"+F2$
92 GET#4,A$,B$,A$,B$,A$,B$
94 GET#4,A$:IFA$>""THEN94
96 GET#4,A$,B$:IFA$=""ANDB$=""THENCLOSE4:GOTO138
98 GET#4,A$,B$:PRINTASC(A$+CHR$(.))+256*ASC(B$+CHR$(.));
100 GET#4,A$:PRINTA$;:IFA$<>CHR$(34)ANDA$>""THEN100
102 IFA$=""THENCLOSE4:GOTO138
104 F$=""
106 GET#4,A$:PRINTA$;:IFA$<>CHR$(34)THENF$=F$+A$:GOTO106
108 GET#4,T$:PRINTT$;:IFT$=" "THEN108
110 GET#4,A$:PRINTA$;:IFA$>""THEN110
112 IF T$<>"S"THENPRINT:GOTO96
114 IFCMTHENPRINTTAB(40)"#"FP+1" - ┴DD":GOTO130
116 PRINTTAB(40)"#"FP+1"┴DD?(┘/╬/┴/╤)";
118 GETA$:IFA$=""THEN118
120 IFA$="N"THENPRINT"╬":GOTO136
122 IFA$="Y"THENPRINT"┘":GOTO130
124 IFA$="Q"THENPRINT"╤":GOTO138
126 IFA$<>"A"THENPRINT:PRINT"┘/╬/┴/╤ ONLY PLEASE";:GOTO116
128 PRINT"┴":CM=1
130 FP=FP+1:F$(FP)=F$:U(FP)=U2:D$(FP)=D2$
132 F1$(FP)=F$:IFLEFT$(F$,LEN(SR$))=SR$THENF1$(FP)=MID$(F$,LEN(SR$)+1)
134 IFFP>999THENPRINT"╘OO MANY FILES.":GOTO150
136 GOTO96
138 PRINT:PRINT"┼ND OF INPUT FILE LIST ON "U2"/"D2$".":CLOSE4:CLOSE15
140 PRINT"─O YOU HAVE MORE FILES ON ANOTHER DRIVE"
142 PRINT"OR PERHAPS MORE ON THIS ONE WITH A"
144 PRINT"DIFFERENT PATTERN? (Y/N) ";:INPUT A$
146 IFA$="Y"THEN64
148 IFA$<>"N"THENPRINTCHR$(17)"'Y' OR 'N' ONLY, PLEASE."CHR$(17):GOTO140
150 PRINT "┼ND OF FILE LIST.":IFFP=0THENPRINT"╬O FILES SELECTED.":STOP
152 PRINT CHR$(17)"╧UTPUT FILE NAME [ARCHIVE.SHAR]";:F3$="ARCHIVE.SHAR":INPUT F3$
154 :
156 PRINTCHR$(17)"╧UTPUT DEVICE/UNIT # [8]";:U3=8:INPUT U3
158 IFU3<3ORU3>31THENPRINT"╔NVALID! 8-31 ONLY PLEASE":GOTO156
160 :
162 PRINTCHR$(17)"╧UTPUT DRIVE # [0]";:D3$="0":INPUT D3$
164 IFD3$<>"0"ANDD3$<>"1"THENPRINT"╔NVALID! 0 OR 1 ONLY PLEASE":GOTO162
166 :
168 OPEN14,U3,15,"I"+D3$:OPEN 3,U3,3,D3$+":"+F3$+",S,W"
170 INPUT#14,A$,B$,C$,D$:IFVAL(A$)=0THEN186
172 CLOSE3:IFA$<>"63"THEN182
174 PRINTCHR$(17)"╧UTPUT FILE ALREADY EXISTS! ╧VERWRITE?"
176 PRINT"(┘/╬) ";:INPUT A$:IFA$="N"THENGOTO184
178 IFA$<>"Y"THENPRINTCHR$(17)"┘ OR ╬ ONLY PLEASE.":GOTO174
180 PRINT#14,"S"+D3$+":"+F3$:CLOSE14:GOTO168
182 PRINT"╧UTPUT FILE ERROR: "A$","B$","C$","D$
184 CLOSE2:CLOSE14:STOP
186 PRINT#3,"#! /BIN/SH":PRINT#3,"#"
188 PRINT#3,"# ╘HIS IS A PSEUDO SHELL ARCHIVE. ╘O UNPACK THIS SHAR, USE"
190 PRINT#3,"# 'SH FILE.SHAR' OR 'SH < FILE.SHAR'.":FL$=""
192 PRINT#3,"# ├ONTENTS: ";:FORA=1 TO FP
194 IFLEN(F1$(A)+FL$)<60THENFL$=FL$+F1$(A)+" ":GOTO200
196 PRINT#3,FL$:PRINT#3,"# ";
198 FL$=""
200 NEXT:PRINT#3,FL$
202 PRINT#3,"# ╫RAPPED BY: "ME$:PRINT#3,"#"
204 PRINT#3,"# ├64 ╙╚┴╥ BY ╩OE ╟RECO <JGRECO@ARCHIMEDES.MATH.UWM.EDU>"
206 PRINT#3,"# 9905 ╫. ═ONTANA ┴VE. ╨LEASE SEND BUG REPORTS, MONEY,"
208 PRINT#3,"# ╫EST ┴LLIS, ╫╔ 53227-3329 ETC. :-)":PRINT#3,"#"
210 PRINT#3,"╨┴╘╚=/BIN:/USR/BIN:/USR/UCB:/USR/LOCAL/BIN ; EXPORT ╨┴╘╚"
212 FOR A=1 TO FP:F$=F$(A):U2=U(A):D2$=D$(A):F1$=F1$(A):GOSUB222:NEXT
214 PRINT#3,"# ─ONE."
216 PRINT#3,"ECHO SHAR: ┼ND OF SHELL ARCHIVE."
218 PRINT#3,"EXIT 0"
220 CLOSE3:END
222 PRINT" "CHR$(145)
224 PRINT "─OING "F$CHR$(145)
226 PRINT#3,"ECHO SHAR: ┼XTRACTING \"CHR$(34)"'"F1$"'\"CHR$(34)
228 PRINT#3,"SED "CHR$(34)"S/^╪//"CHR$(34)" >'"F1$"' <<'┼╬─ñ╧╞ñ╞╔╠┼'"
230 OPEN2,U2,2,D2$+":"+F$
232 SYS ML
234 CLOSE2
236 PRINT#3,"┼╬─ñ╧╞ñ╞╔╠┼"
238 RETURN
240 DATA76,3,192,169,13
242 DATA141,101,192,32,204
244 DATA255,162,2,32,198
246 DATA255,160,0,32,228
248 DATA255,153,0,196,165
250 DATA144,41,64,208,32
252 DATA200,192,254,208,239
254 DATA32,204,255,162,3
256 DATA32,201,255,160,0
258 DATA185,0,196,32,102
260 DATA192,200,192,254,208
262 DATA245,32,204,255,76
264 DATA8,192,32,204,255
266 DATA162,3,32,201,255
268 DATA200,132,97,160,0
270 DATA185,0,196,32,102
272 DATA192,200,196,97,208
274 DATA245,173,101,192,201
276 DATA13,240,5,169,13
278 DATA32,210,255,76,204
280 DATA255,0,72,173,101
282 DATA192,201,13,208,5
284 DATA169,216,32,210,255
286 DATA104,141,101,192,76
288 DATA210,255,-1
;├┬═4-2 ┴╥├ JS╙╚┴╥ ┬┴╙ JE╔╠┼┬┴╙┼├╧═ ╞?═2